package com.xxl.aop;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * 全局回复类的aop切面：主要是打印具体返回值
 * @author xxl
 * @date 2023/4/2
 */
@Component
@Aspect
@Slf4j
public class ResultAop {
    @Pointcut("execution( * com.xxl.util.GlobalResult.* (..))")
    public void pointCut() {

    }

    @AfterReturning(pointcut = "pointCut()",returning = "result")
    public void logResult(JoinPoint point,Map<String,Object> result) {

        log.warn("[切入点具体信息="+point.getSignature().toString()+"]");
        log.warn("[全局result="+result.toString()+"]");
    }

}
